package com.example.aigc_education.enums;

import lombok.Getter;

@Getter
public enum TodoPriorityType {
//    "priority": "enum('high', 'medium', 'low'), required, 优先级",
    HIGH("high",1),
    MEDIUM("medium",2),
    LOW("low",3);


    private final String title;

    private final Integer value;
    TodoPriorityType(String title, Integer value) {
        this.title = title;
        this.value = value;
    }

    //fromTitle
    public static TodoPriorityType fromTitle(String title) {
        for (TodoPriorityType todoPriorityType : TodoPriorityType.values()) {
            if (todoPriorityType.title.equals(title)) {
                return todoPriorityType;
            }
        }
        throw new IllegalArgumentException("无效的优先级标题: " + title);
    }
    public static TodoPriorityType fromValue(Integer value) {
        for (TodoPriorityType todoPriorityType : TodoPriorityType.values()) {
            if (todoPriorityType.value.equals(value)) {
                return todoPriorityType;
            }
        }
        throw new IllegalArgumentException("无效的优先级值: " + value);
    }


}

